using UnityEngine;
using System.Collections;

public class AutoScale : MonoBehaviour {
	// Use this for initialization
	void Awake () {
		//Geometry scale
		transform.localScale *= Constant.GameSettings.ScaleFactor;
		
		//Scale all Particles children
		foreach (Component com in transform.GetComponentsInChildren<Component>()){
			if (com is ParticleEmitter){
				ParticleEmitter emitter = (com as ParticleEmitter);
				emitter.minSize *= Constant.GameSettings.ScaleFactor;
				emitter.maxSize *= Constant.GameSettings.ScaleFactor;
				emitter.localVelocity *= Constant.GameSettings.ScaleFactor;
				emitter.rndVelocity *= Constant.GameSettings.ScaleFactor;
				emitter.worldVelocity *= Constant.GameSettings.ScaleFactor;
			}
			
			if (com is ParticleAnimator){
				ParticleAnimator animator = (com as ParticleAnimator);
				animator.force *= Constant.GameSettings.ScaleFactor;
				animator.rndForce *= Constant.GameSettings.ScaleFactor;
			}
		}
	}	
}
